# @Author：silence
# @Email：792245022@qq.com
# @Date：2025/2/19 23:29

"""
基本语法
变量: 类型

"""

# 基础数据类型注解
n1: int = 10
n2: float = 10.1
is_pass: bool = True
name: str = "silence"


# 定义 类 Cat
class Cat:
    ...


# 实例对象类型注解
cat: Cat = Cat()

# 容器类型注解
my_list: list = [100, 200, 300]
my_tuple: tuple = ("run", "sing", "fly")
my_set: set = {"jack", "tim", "hsp"}
my_dict: dict = {"n01": "北京", "n02": "上海"}

# 容器详细类型注解
my_list2: list[int] = [100, 200, 300]
# 元组类型设置详细类型注解，需要把每个元素类型都标注一下
my_tuple2: tuple[str, str, str, float] = ("run", "sing", "fly", 1.1)
my_set2: set[str] = {"jack", "tim", "hsp"}
# 字典类型设置详细类型注解，需要设置两个类型，即[key类型, value类型]
my_dict2: dict[str, int] = {"n01": 100, "n02": 200}

# 注释中使用注解
# 解读：# type: float 用于标注 变量 n3 的类型是 float
n3 = 89.9 # type: float
my_list3 = [100,200,300] # type: list[int]
email = "hsp@sohu.com" # type: str